using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using Castle.ActiveRecord;
using NHibernate.Expression;

namespace WOODIFramework.Model
{
    [ActiveRecord("BasicGridColumn")]
    public class BasicGridColumn : PageItem
    {
        #region Fields

        private Guid _basicGridColumnId;
        private int _width;
        private bool _display;
        private IList _grids = new ArrayList();
        private bool _isBold;
        private string _hyperlinkFormatText;
        private bool _isHyperlink;

        #endregion

        #region Properties

        [JoinedKey("basicGridColumnId")]
        public Guid BasicGridColumnId
        {
            get { return _basicGridColumnId; }
            set { _basicGridColumnId = value; }
        }

        [Property]
        public int Width
        {
            get { return _width; }
            set { _width = value; }
        }

        [Property]
        public bool Display
        {
            get { return _display; }
            set { _display = value; }
        }

        [HasAndBelongsToMany(typeof(BasicGrid), Table = "BasicGridColumn_LK", ColumnKey = "BasicGridColumnId", ColumnRef = "BasicGridId")]
        public IList Grids
        {
            get { return _grids; }
            set { _grids = value; }
        }

        //TODO: Change to use style class for column
        [Property]
        public bool IsBold
        {
            get { return _isBold; }
            set { _isBold = value; }
        }

        [Property]
        public bool IsHyperlink
        {
            get { return _isHyperlink; }
            set { _isHyperlink = value; }
        }

        [Property]
        public string HyperlinkFormatText
        {
            get { return _hyperlinkFormatText; }
            set { _hyperlinkFormatText = value; }
        }

        #endregion

        #region Constructors

        private BasicGridColumn()
        {
            this.Id = Guid.NewGuid();
            this.BasicGridColumnId = this.Id;
        }

        private BasicGridColumn(string Name)
        {
            this.Id = Guid.NewGuid();
            this.BasicGridColumnId = this.Id;
            this.Name = Name;
        }

        private BasicGridColumn(string Name, string DisplayName)
        {
            this.Id = Guid.NewGuid();
            this.BasicGridColumnId = this.Id;
            this.Name = Name;
            this.DisplayName = DisplayName;
        }

        #endregion

        #region Public Methods

        #region Public Static Methods

        public static BasicGridColumn CreateBasicGridColumn()
        {
            BasicGridColumn column = new BasicGridColumn();
            return column;
        }

        public static BasicGridColumn CreateBasicGridColumn(string Name)
        {
            BasicGridColumn column = new BasicGridColumn(Name);
            return column;
        }

        public static BasicGridColumn CreateBasicGridColumn(string Name, string DisplayName)
        {
            BasicGridColumn column = new BasicGridColumn(Name, DisplayName);
            return column;
        }

        #endregion

        #endregion
    }
}
